package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021001198637228";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCqDeaA1b3wHPSqxvP9argXpBNIBx9M1+tN90sI/n5+2xHyhtC9FeAaCTDTb+Zk/vWj5mZoApxw9M1gLD0Qxx3rRZQgHWk5wS8gqGF8MYiqwhvSv7U2eD7mRYmkFykmZa9KdgBNl5Mu05sP1dAbXE4BEIBkmf/FVSfd/riJl6rbaIGZynSwxzkDZRDpebLDuipxQ4VCdz3L3H/8vYlr6w7GmB2YWtinRQtHoxNxS5tFY6qBH962zqDI+gLVkeg+Qr87+MWYx8IO1B16ZYet3KzsdYVKGq71vKYhuJ3sE2jEP2Wa5msQGKar+qid5XJaLNBOij3Uu6XH+Z3Mokqk6GALAgMBAAECggEAb0xLubSq7JU2+PLfy9NmC2sCh5jJvpRu2AdrH8bY6ZPdyjq8MZU4qDGtuCS7yQwpnwzzp01WMIO4SyKJEQsRJOPUD7TQItGyU5CAxTTyOrhyV1vLcYv/ttx6OmBCOXRB5t0WU7JJzVMHYLTS0KV4FDBFqBI2mWOjhSLqinsugwxu1f1famxY/FlkKWSw3zZyVIL2OfWCglj8mK5nlgxIUMN3cA58pmP+K6oBaLryPF+4rT5f2OX7YylOsSebktCsY+jXg/EXZsnQOerCCXT/TyYnIkWObqRttc9R0JKq+5TJGELjJTDTB6gA50ldN3F9jbcOXRfac2QUBGPEGdsZwQKBgQDsMFpYIPPTy94SIs+pFBfjeKNe6YSc2/hHkdidkaBsza3H4KmlWpAFAR+KZacRvxQyWTc/Zuc+Ly1ymym0uuN3xO6IsgICjUEsBoXlVa9OXpPeGwoUMSq9hd/jIa9rKQpE5yGtUaSGlRfYI5BqUgyVcdCByMJ/n5TO4bj7kAbsawKBgQC4UXMuzumbas4XzvwmD2TdoVfEb/OJ/Vpk0vC2kI2w2FwAK5LsvJd9ZMQqgjCSk6NTANDU+9jF4JXdS2i3U9CidfbctH3VX/cJwd+3zii+yvbzzw9b4+SDqjG+Y+Ag+SH3IGFm1qfJNhy1u2Q0sy+tDyeEBuw35/r1E46a6V1C4QKBgEhn7lpUB8unFPYkW9rugQBIDHVdSz03Jh7ytCBh83dHen3q/rblU39lP8EStqv3Ev74YLp8Fmn21ozqyldQb8lYwvN+9qTHnvIbMdMDeJGi5tvRGD7mb77YGrGrsvY8B5zl6moSvEhRzpSBGpWtf5QU5yHSZOXxCxJ9GlNsbOLvAoGAYL6nxZbneSMbX9XN9bA40jfgmIPmgbRQoQEzRbAkHwHBcHlumgH3ReMBMAq7sgP6QxP3iQNT6bETGF9/bFJ6/PsMAxZdwgSn5yAy7AgyzMo9ywUQ27uHczB/AZ7swoHhuRPu7AqZcPyNHzpnw12WFbERnbQAguuphr+oJ1l8ESECgYEAih1+NLxl7G/3bemW5c5c9zgCUOaNFnoJScwDY0vAVHijHesi483zFWfrjkEjVIh1OyT1qau26mpRd2yIf0HTeYHOruBkT8CENuLEMEjdEqnmvGcTcdqF0pBSYL2Yp5T2hVcHq/OHV5D+J/9Xog3xyO4J25lNL0aWtBhR+AvBt/w=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqg3mgNW98Bz0qsbz/Wq4F6QTSAcfTNfrTfdLCP5+ftsR8obQvRXgGgkw02/mZP71o+ZmaAKccPTNYCw9EMcd60WUIB1pOcEvIKhhfDGIqsIb0r+1Nng+5kWJpBcpJmWvSnYATZeTLtObD9XQG1xOARCAZJn/xVUn3f64iZeq22iBmcp0sMc5A2UQ6Xmyw7oqcUOFQnc9y9x//L2Ja+sOxpgdmFrYp0ULR6MTcUubRWOqgR/ets6gyPoC1ZHoPkK/O/jFmMfCDtQdemWHrdys7HWFShqu9bymIbid7BNoxD9lmuZrEBimq/qoneVyWizQToo91Lulx/mdzKJKpOhgCwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/500.html";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/paySuccess";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "d:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

